package com.hkd.base_service.api.fallback;

import com.hkd.base_service.api.AreaService;
import com.hkd.base_service.api.dto.AreaUploadDTO;
import com.hkd.base_service.api.vo.AreaGetVo;
import com.hkd.common.api.ApiResponse;
import com.hkd.common.api.BaseFallBack;
import com.hkd.common.api.BaseFallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author HKD
 * @date 2022/9/11 1:38
 */
@Component
public class AreaServiceImplFallback extends BaseFallbackFactory<AreaService> {
    @Override
    public AreaService create(Throwable throwable) {
        FeignFallback fallback = new FeignFallback();
        fallback.setCause(throwable);
        return fallback;
    }
    public class FeignFallback extends BaseFallBack implements AreaService {

        @Override
        public ApiResponse uploadArea(String curUserId,List<AreaUploadDTO> uploadDTOS) {
            return defaultFallBack();
        }

        @Override
        public ApiResponse<List<AreaGetVo>> getAll(String areaCode) {
            return defaultFallBack();
        }
    }
}
